package com.project.springboot.controller;

import com.project.springboot.dataobject.Product;
import com.project.springboot.service.product.ProductService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * Description：商品Controller
 * Created by 朱正磊 on 2019/3/18 0018 下午 3:49
 */
@Controller
@RequestMapping("/product")
public class ProductController {

    @Resource
    private ProductService productService;

    @GetMapping("/list")
    public ModelAndView list(Map<String, Object> map) {
        List<Product> productList = productService.findAll();
        map.put("productList", productList);
        return new ModelAndView("product/productList", map);
    }

}
